Learn R Programming

VeryLargeIntegers (version 0.1.8)

17. Euler's phi function: Euler's Phi Function for vli Objects

Description

Euler's Phi Function for vli (Very Large Integers) objects. Given a positive integer x, the Euler's Phi Function returns the number of positive integers up to x that are relatively prime to x.

Usage

phi(x)

# S3 method for default phi(x)

# S3 method for numeric phi(x)

# S3 method for vli phi(x)

Value

object of class vli

Arguments

x

positive integer; object of class vli or 32 bits integer

Author

Javier Leiva Cuadrado

Details

The returned value by the phi function is equal to the order of the group of units of the ring Z/Zn (the multiplicative group of integers modulo n). It is also called Euler's Totient Function, and plays a major part in Number Theory and in the RSA Cryptosystem.

Examples

Run this code
if (FALSE) {
x <- as.vli("24352")
phi(x)
}

Run the code above in your browser using DataLab